# -*- encoding: utf-8 -*-
from django.contrib import admin

from models import Categorie, Billet

##
# Categorie
class CategorieAdmin(admin.ModelAdmin):
    list_display = ('name', 'slug')
    search_fields = ['name', 'slug']
    prepopulated_fields = {"slug": ("name",)}


admin.site.register(Categorie, CategorieAdmin)

##
# Billets
class BilletAdmin(admin.ModelAdmin):
    list_display = ('title', 'created_at', 'updated_at', 'published_at', 'is_draft')
    ordering = ['updated_at', 'title']
    search_fields = ['title']
    prepopulated_fields = {"slug": ("title",)}

    class Media:
        js = (
            "/medias/js/tiny_mce/tiny_mce.js",
            "/medias/js/tiny_conf.js",
            )

admin.site.register(Billet, BilletAdmin)
